#pragma once

#include <ShObjIdl.h>
#include <ShlGuid.h>
#include <Shlobj.h>
#include <shlwapi.h>

#include <list>
#include <vector>
#include <functional>


HRESULT GetDisplayName(const TCHAR *szParsingPath, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags);
HRESULT GetDisplayName(PCIDLIST_ABSOLUTE pidl, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags);

HRESULT BindToIdl(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv);
BOOL IsPathGUID(const TCHAR *szPath);
HRESULT GetFolderPathForDisplay(PCIDLIST_ABSOLUTE pidl, TCHAR* szPath);
HRESULT GetItemAttributes(PCIDLIST_ABSOLUTE pidl, SFGAOF *pItemAttributes);
BOOL IsIdlDirectory(PCIDLIST_ABSOLUTE pidl);


typedef BOOL(CALLBACK *FOLDERCONTENTPROC)(LPCTSTR, LPITEMIDLIST, DWORD);
void StrretToString(LPITEMIDLIST pidl, LPSTRRET pStr, LPTSTR pszBuf);
int EnumFolderContent(LPSHELLFOLDER pFolder, FOLDERCONTENTPROC pfn, DWORD dwData, LPITEMIDLIST* ppidl);
HRESULT PathToPidl(LPTSTR szPath, LPITEMIDLIST* ppidl, LPSHELLFOLDER pFolder = NULL);
void PathToShellFolder(LPTSTR szPath, LPSHELLFOLDER& pSubFolder);

void EnumFolder(IShellFolder* pShellFolder, std::function< bool(LPCTSTR, LPITEMIDLIST, UCHAR)> func, UCHAR level = 0);